/*
 * =====================================================================================
 *
 *       Filename:  cl_socket_addr4.hxx
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  03/24/2011 05:37:22 AM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Chen Ken (Ken), zlchen.ken@gmail.com
 *        Company:  EMC
 *
 * =====================================================================================
 */

#ifndef _CL_SOCKET_ADDR_IN4_HXX_
#define _CL_SOCKET_ADDR_IN4_HXX_

#include <netinet/in.h>
#include <string>
#include "cl_socket_addr.hxx"
#include "cl_common_defs.hxx"

namespace neo
{
class CLSocketAddrIn4: public CLSocketAddr
{
public: 
	CLSocketAddrIn4(const std::string& host, int port, CLSocketType type);
  CLSocketAddrIn4(const struct sockaddr* addr);
	~CLSocketAddrIn4();
	
private:
	void initAddr(const std::string& host, int port, CLSocketType type);

private:
	virtual CLSocketAddr* doClone(void) const;
  virtual int getFamily(void) const;
	virtual size_t getSize(void) const;
	virtual const struct sockaddr* getAddress(void) const;
	virtual bool doIsValid(void) const;
  virtual const std::string doToString(void) const;

private:
  struct sockaddr_in m_sockAddr;
};

} // neo

#endif //_CL_SOCKET_ADDR_IN4_HXX_

